home *** CD-ROM | disk | FTP | other *** search
/ Mesolore / Mesolore - Disc 1.iso / pc / data / Buttons.cst / 00265_Script_Bookmarks < prev    next >
Text File  |  2001-04-13  |  5KB  |  172 lines

  1. -- BOOKMARKS --
  2.  
  3. global gSelectedLine, gRetraceList, gBookMarkRemoveSpr, gBookMarkGoSpr, gBookmarks, gMIAW
  4.  
  5. on showBookmarks  -- invoked from Bookmark pulldown menu
  6.   open window "Bookmarks"
  7.   set the windowtype of window "Bookmarks" = 4
  8.   tell window "bookmarks" to set the visible of sprite 5 = FALSE
  9.   tell window "bookmarks" to  set the visible of sprite 6     = FALSE
  10.   tell window "bookmarks" to   hilite line 1 of field "input"
  11. end showBookmarks
  12.  
  13. on shownotepad  -- invoked from Bookmark pulldown menu
  14.   open window "Notepad"
  15.   set the windowtype of window "Notepad" = 4
  16.   
  17. end 
  18.  
  19.  
  20. on selectBookmark  -- invoked when user clicks on text field within Bookmark MIAW
  21.   put the mouseLine into gSelectedLine
  22.   
  23.   if gSelectedLine > 0 then
  24.     set the visible of sprite 5 = TRUE
  25.     set the visible of sprite 6     = TRUE
  26.     hilite line gSelectedLine of field "Bookmarks"
  27.   end if
  28. end selectBookmark
  29.  
  30. -- These handlers are invoked when the user clicks one of the buttons in the
  31. -- Bookmark MIAW.
  32.  
  33. on addBM
  34.   cursor 4
  35.   updatestage
  36.   put getLast( gRetraceList )into temp
  37.   --put searchScreenIndex(temp) into temp2
  38.   --put temp2 & "                                                                           #"&temp & RETURN after field "Bookmarks"
  39.   if field "input" = "" then
  40.     alert "Please enter your bookmark's name before clicking the ADD button."
  41.   else
  42.     put field "input" & "                                                                              #" & temp & RETURN after field "Bookmarks"
  43.     set the visible of sprite 5 = FALSE
  44.     set the visible of sprite 6     = FALSE
  45.     set gBookmarks = field "Bookmarks"
  46.     put "" into field "input"
  47.   end if
  48.   cursor 0
  49.   updatestage
  50. end addBM
  51.  
  52. on searchScreenIndex temp
  53.   
  54.   if char 1 of temp = "T" then
  55.     put "ScreenIndex2" into searchfield
  56.   else
  57.     put "ScreenIndex1" into searchfield
  58.   end if
  59.   
  60.   put field (searchfield) into hold
  61.   
  62.   put the number of lines in hold into HM
  63.   set the itemdelimiter = "#"
  64.   repeat with x = 1 to HM
  65.     if temp = item 1 of line x of hold then
  66.       return item 2 of line x of hold
  67.       exit repeat
  68.     end if
  69.   end repeat
  70.   set the itemdelimiter = ","
  71. end
  72.  
  73. on removeBM
  74.   if gSelectedLine > 0 then
  75.     delete line gSelectedLine of field "Bookmarks"
  76.     set gBookmarks    = field "Bookmarks"
  77.     set gSelectedLine = 0
  78.   end if
  79.   set the visible of sprite 5 = FALSE
  80.   set the visible of sprite 6     = FALSE
  81. end removeBM
  82.  
  83. on goBM
  84.   if gSelectedLine > 0 then
  85.     set the itemdelimiter = "#"
  86.     set destination = item 2 of line gSelectedLine of field "Bookmarks"
  87.     if destination <> "" then 
  88.       set the itemdelimiter = "*"
  89.       tell the stage to goTo item 1 of destination, item 2 of destination
  90.       set the itemdelimiter = ","
  91.     end if
  92.   end if
  93. end goBM
  94.  
  95. on saveAsNotepad
  96.   set fio = new(XTRA "fileio")
  97.   filename = fio.displaySave("Save file as","my notepad.txt")
  98.   fio.createfile(filename)
  99.   fio.openfile(filename,2)
  100.   fio.writestring(field "bookmarks")
  101.   if the platform contains "macintosh" then
  102.     fio.setFinderInfo("TEXT ttxt")
  103.   end if
  104.   fio.closefile()
  105.   fio=0
  106. end 
  107.  
  108. on saveAsBM
  109.   set fio = new(XTRA "fileio")
  110.   filename = fio.displaySave("Save file as","my bookmarks.txt")
  111.   fio.createfile(filename)
  112.   fio.openfile(filename,2)
  113.   fio.writestring(field "bookmarks")
  114.   if the platform contains "macintosh" then
  115.     fio.setFinderInfo("TEXT ttxt")
  116.   end if
  117.   fio.closefile()
  118.   fio=0
  119. end saveAsBM
  120.  
  121.  
  122. on loadnotepad
  123.   set fio = new(XTRA "fileio")
  124.   if the platform contains "macintosh" then
  125.     fio.setfiltermask("TEXT")
  126.   else
  127.     fio.setfiltermask("*.txt")
  128.   end if
  129.   filename = fio.displayOpen()
  130.   if not voidp(filename) and not (filename = EMPTY) then
  131.     fio.openfile(filename,1)
  132.     if fio.status() = 0 then
  133.       theFile = fio.readFile()
  134.       put theFile into field "bookmarks"
  135.     else
  136.       alert "error"
  137.     end if
  138.   end if
  139.   
  140.   fio.closefile()
  141.   fio = 0
  142. --  set the visible of sprite 5 = FALSE
  143. --  set the visible of sprite 6     = FALSE
  144. --  put "" into field "input"
  145. end
  146.  
  147.  
  148. on loadBM
  149.   set fio = new(XTRA "fileio")
  150.   if the platform contains "macintosh" then
  151.     fio.setfiltermask("TEXT")
  152.   else
  153.     fio.setfiltermask("*.txt")
  154.   end if
  155.   filename = fio.displayOpen()
  156.   if not voidp(filename) and not (filename = EMPTY) then
  157.     fio.openfile(filename,1)
  158.     if fio.status() = 0 then
  159.       theFile = fio.readFile()
  160.       put theFile into field "bookmarks"
  161.     else
  162.       alert "error"
  163.     end if
  164.   end if
  165.   
  166.   fio.closefile()
  167.   fio = 0
  168.   set the visible of sprite 5 = FALSE
  169.   set the visible of sprite 6     = FALSE
  170.   put "" into field "input"
  171. end loadBM
  172.